<script lang="ts" setup>
// 渲染markdown格式
import MarkdownIt from 'markdown-it'
// import hljs from 'highlight.js'
import markdownItCodeCopy from '@/utils/markdown-it-code-copy.ts'
import MarkdownItHightlightJS from 'markdown-it-highlightjs'
import 'highlight.js/styles/atom-one-dark.css'
import '@/styles/code-copy.css'
defineOptions({
  name: 'md-html'
})

const props = defineProps({
  text: {
    type: String,
    default: ''
  }
})

const markdown = new MarkdownIt().use(MarkdownItHightlightJS).use(markdownItCodeCopy)
</script>

<template>
  <div v-html="markdown.render(props.text)"></div>
</template>

<style lang="scss" scoped>
</style>
